package my.package0414;

import java.util.Random;
import java.util.Scanner;

public class guessnumber {
    public static void main(String[] args) {
        Random r =new Random();
        int number =r.nextInt(100)+1;
        Scanner sc =new Scanner(System.in);
        for (int i=1;i<=100;i++){
            System.out.println("请输入你要猜的数字:");
            int guessNumber =sc.nextInt();
            if (guessNumber== number) {
                System.out.println("程序结束！");
                if(i==1){
                    System.out.println("你真厉害，一次就猜对了！");
                    break;
                }
                else if((i>=2)&&(i<=4)){
                    System.out.println("你很聪明，猜对了！");
                    break;
                }
                else if((i>=5)&&(i<=100)){
                    System.out.println("笨蛋，你猜这么多次！");
                    break;
                }
            } else if (guessNumber>number) {
                System.out.println("你猜的数字"+guessNumber+"大了");
            }else {
                System.out.println("你猜的数字"+guessNumber+"小了");
            }
        }

    }
}
